package com.hnhegui.backend.order.repository;

import com.hnhegui.backend.order.entity.OrderDocument;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.elasticsearch.repository.ElasticsearchRepository;
import org.springframework.stereotype.Repository;

/**
 * 订单Elasticsearch Repository
 */
@Repository
public interface OrderRepository extends ElasticsearchRepository<OrderDocument, String> {

    /**
     * 根据订单号查询
     */
    OrderDocument findByOrderNo(String orderNo);

    /**
     * 根据用户ID查询订单列表
     */
    Page<OrderDocument> findByUserId(String userId, Pageable pageable);

    /**
     * 根据用户ID和状态查询订单列表
     */
    Page<OrderDocument> findByUserIdAndStatus(String userId, String status, Pageable pageable);
}
